<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/include/base.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head>
<script  type="text/javascript"	src="static/js/pageListComm.js"></script>
<link rel="shortcut icon" href="img/favicon.png"/>
</head>
  <body>
<script type="text/javascript">
$(function(){
	
	//加载所有的部门信息  放入多选框中
	getAllDept("#deptSelect select","${APP_PATH}/deptGroup");
	
	$("#personForm").find('input[type=text],select,textarea').each(function() {
			  $(this).attr("disabled",false);
	});
	//设置id显示框不可写
	$("#userIdInput").attr("disabled",true);
	
	//添加角色信息
	$("#userTypeSelect select").empty();
	$("#userTypeSelect select").append($("<option></option>").val(0).html("管理员"))
						.append($("<option></option>").val(1).html("普通员工"));
	
	//清空输入框
	$("#resetPerson").click(function(){
		$("#personForm").find('input[type=text],select,textarea').each(function() {
			  $(this).val('');
		});
	});
	
	//保存用户消息
	$("#savePerson").click(function(){
		//alert($("#personForm").serialize());
		//验证用户名密码是否为空  密码 电话号码 手机 是否符合规则
		//ajax提交
		$.ajax({
			url:"${APP_PATH}/person",
			type:"POST",
			data:$("#personForm").serialize(),
			success:function(result){
				 if(result.code == 200){
						 //显示失败消息  失败
					alert(result.extend.msg);
						 //关闭模态框
				}
				window.location.href="${APP_PATH}/person/person-list.jsp";
			}
		});
	});
})
	
</script>
<c:set value="99999" var="target" scope="session"></c:set>
  <!-- container section start -->
	<section id="container" class=""> 
		<%@include file="/WEB-INF/include/top.jsp"%> 
		<%@include file="/WEB-INF/include/left.jsp"%> 
		<!--main content start-->
	<section id="main-content"> 
		<section class="wrapper">
			<div class="row">
				<div class="col-lg-12">
					<ol class="breadcrumb">
						<li><i class="fa fa-home"></i><a href="index.jsp">人员管理</a></li>
						<li id="personMessageLabel"><i class="fa fa-table"></i>新增人员</li>
					</ol>
		
				</div>
			</div>
		</section> 
		<div class="row" align="center" style="margin: 0 auto">
			<div class="col-lg-12">
			<section class="">

			<form class="form-horizontal" id="personForm">
				<%@include file="/WEB-INF/include/personMessage.jsp"%>

				<div style="margin-left: 600px">
					<input id="savePerson" data-toggle="modal" class="btn btn-primary"
						type="submit" value="提交信息" /> 
					<input id="resetPerson" data-toggle="modal" class="btn btn-warning" type="reset"
						value="清空信息" /> 
					<input data-toggle="modal" class="btn btn-danger"
						onclick="javascript:history.back()" type="button" value="返回" />

				</div>


			</form>

			</section>
	
		</section> 
	</section>

	<!-- javascripts -->
    <script src="js/jquery.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <!-- nicescroll -->
    <script src="js/jquery.scrollTo.min.js"></script>
    <script src="js/jquery.nicescroll.js" type="text/javascript"></script>
    <!--custome script for all page-->
    <script src="js/scripts.js"></script>


  </body>
</html>
